<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Title</title>
  </head>
  <body>

  </body>

  <script>
      let text = {
          str: 'str',
          num: 10,
          array: [1, 2, 3],
      };

      let jsonStr = JSON.stringify(text)
      console.log(jsonStr);//{"str":"str","num":10,"array":[1,2,3]}
      console.log(typeof jsonStr);//string

      let jsonObj = JSON.parse(jsonStr)
      console.log(jsonObj)//{str: 'str', num: 10, array: Array(3)}
      console.log(typeof jsonObj)//object
  </script>
</html>